<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 群威
  Date: 2017/9/22
  Time: 21:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="common/tag.jsp"%>
<html>
<head>
    <title>员工列表</title>
    <%@ include file="common/head.jsp"%>
</head>
<body>
<div class="table-responsive">
    <caption>员工列表</caption>
    <div style="display: inline;float: right;">
        <c:if test="${pageBean.rid<3}">
            <button onclick="javascript:ManagerSystem.addPage.addEmployee({did:${pageBean.did},rid:${pageBean.rid}})" type="button" class="btn btn-info">添加员工</button>
        </c:if>
    </div>
<table class="table table-bordered">
    <thead>
        <tr>
            <th>序号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>工号</th>
            <th>部门</th>
            <th>职位</th>
            <th>出生日期</th>
            <th>入职日期</th>
            <c:if test="${pageBean.rid != 3}">
            <th>修改</th>
            <th>删除</th>
            </c:if>
        </tr>
    </thead>
    <tbody>
        <c:forEach items="${pageBean.list}" var="list" varStatus="vs">
            <tr>
                <td>${vs.count+(pageBean.currentPage-1)*pageBean.pageSize}</td>
                <td>${list.ename}</td>
                <td>${list.egender}</td>
                <td>${list.enumber}</td>
                <td>${list.edepartment.dname}</td>
                <td>${list.erole.rname}</td>
                <td><fmt:formatDate value="${list.ebirthday}" pattern="yyyy-MM-dd"/></td>
                <td><fmt:formatDate value="${list.ejoindate}" pattern="yyyy-MM-dd"/></td>
                <c:if test="${pageBean.rid != 3}">
                <td><a href="javascript:void(0)" onclick="javascript:ManagerSystem.editPage.editEmployee({eid:${list.eid},rid:${pageBean.rid},did:${pageBean.did}})"><img src="${pageContext.request.contextPath}/images/commons/edit.png"></a></td>
                <td><a href="javascript:void(0)" onclick="javascript:ManagerSystem.deletePage.deleteEmployee({eid:${list.eid},rid:${pageBean.rid},did:${pageBean.did}})"><img width="20" height="20" src="${pageContext.request.contextPath}/images/commons/delete.png"></a></td>
                </c:if>
            </tr>
        </c:forEach>
    </tbody>
</table>
<!-- 添加的员工页面分页 -->
<table border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr>
        <td align="center">
            <c:if test="${pageBean.totalCount != 0}">
                <span>
                    <c:if test="${pageBean.currentPage != 1}">
                        <a href="javascript:void(0)" onclick="javascript:ManagerSystem.detailPage.employeeList({currentPage:1,did:${pageBean.did},rid:${pageBean.rid}})">[首页]</a>
                        <a href="javascript:void(0)" onclick="javascript:ManagerSystem.detailPage.employeeList({currentPage:${pageBean.currentPage-1},did:${pageBean.did},rid:${pageBean.rid}})">[上一页]</a>
                    </c:if>
                    <c:if test="${pageBean.currentPage != pageBean.totalPage}">
                        <a href="javascript:void(0)" onclick="javascript:ManagerSystem.detailPage.employeeList({currentPage:${pageBean.currentPage+1},did:${pageBean.did},rid:${pageBean.rid}})">[下一页]</a>
                        <a href="javascript:void(0)" onclick="javascript:ManagerSystem.detailPage.employeeList({currentPage:${pageBean.totalPage},did:${pageBean.did},rid:${pageBean.rid}})">[尾页]</a>
                    </c:if>
                </span>
            </c:if>
        </td>
    </tr>
    <tr>
        <td align="center">
            <c:if test="${pageBean.totalCount !=0}">
                <span>
                    第 ${pageBean.currentPage} / ${pageBean.totalPage} 页
                </span>
            </c:if>
            <span>
                    共 ${pageBean.totalCount} 条记录
                </span>
        </td>
    </tr>
</table>
</div>
</body>
<%@ include file="common/bootstrap.jsp"%>
<script src="<%=request.getContextPath()%>/resources/scripts/ManagerSystem.js" type="text/javascript"></script>
</html>
